<!-- 设备管理-设备管理-场地台账 -->
<template>
  <div class="JNPF-common-layout">
    <div class="JNPF-common-layout-center">
      <el-row class="JNPF-common-search-box" :gutter="16">
        <el-form @submit.native.prevent>

          <el-col :span="6">
            <el-form-item label="基地名称">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="楼名称">
              <el-select v-model="listQuery.fgrade" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options2"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <template v-if="showAll">

            <el-col :span="6">
            <el-form-item label="楼层名称">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options3"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="场地名称">
              <el-input v-model="listQuery.fpoint" placeholder="请输入产地编号或名称" clearable />
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="固定资产码">
              <el-input v-model="listQuery.fbillno" placeholder="固定资产码" clearable />
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="设备名称">
              <el-input v-model="listQuery.fbillno" placeholder="设备名称" clearable />
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="设备序号">
              <el-input v-model="listQuery.fsrcbillno" placeholder="设备序号" clearable />
            </el-form-item>
          </el-col>

            <el-col :span="6">
              <el-form-item label="设备状态">
                <el-select v-model="listQuery.fbillstate" placeholder="请选择">
                  <el-option
                  v-for="item in options4"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
                </el-select>
              </el-form-item>
            </el-col>

          </template>
          <el-col :span="8">
            <el-form-item label="">
              <el-button type="primary" icon="el-icon-search" >查询</el-button>
              <el-button type="primary" icon="el-icon-plus" @click="insert(undefined)">新增</el-button>
              <el-button type="success" icon="el-icon-download">导出</el-button>
              <el-button type="text" icon="el-icon-arrow-down" @click="showAll = true" v-if="!showAll">展开</el-button>
              <el-button type="text" icon="el-icon-arrow-up" @click="showAll = false" v-else>
                收起</el-button>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>
      <div class="JNPF-common-layout-main JNPF-flex-main">
        <JNPF-table :data="list" border v-loading="loading">
          <el-table-column prop="FHOME" label="基地名称" ></el-table-column>
          <el-table-column prop="FFLOOR" label="所属楼" ></el-table-column>
          <el-table-column prop="FGRAND" label="所属楼层" ></el-table-column>
          <el-table-column prop="FADDRES" label="场地名称"></el-table-column>
          <el-table-column prop="FCARDNO" label="摄像头编号"  ></el-table-column>
          <el-table-column prop="FCATNAME" label="设备名称" ></el-table-column>
          <el-table-column prop="FBRAND" label="品牌"  ></el-table-column>
          <el-table-column prop="FBILLSTATE" label="状态" ></el-table-column>
          <el-table-column fixed="left" label="操作" align="center" width="150">
            <template slot-scope="scope">
              <el-button type="text" @click="insert(scope.row.FBILLNO)" size="small" icon="el-icon-edit">
                编辑
              </el-button>

              <el-popconfirm title="确定删除当前数据吗？" @confirm="Catdelete(scope.row.FCATNO)">
                <el-button slot="reference" icon="el-icon-delete" style="color: red;margin-left: 10px;"
                  type="text">删除</el-button>
              </el-popconfirm>

            </template>              
          </el-table-column>
        </JNPF-table>
        <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit"/>
        <Form ref="Form"  :formationlist="customlist" />
      </div>
    </div>
  </div>
</template>
<script>
  import Form from "./Form.vue"
  import jnpf from "@/utils/jnpf"
  export default {
    name: 'shop',
    components: { Form },
    data() {
      return {
        showAll: false,

        //所属教学楼选择数据
        options1: [{
          value: '10',
          label: '上海国际汽车城'
        }, {
          value: '20',
          label: '中共一大会址纪念馆'
        }, {
          value: '30',
          label: '上海博物馆'
        }],

        //所属楼层选择数据
        options2: [{
          value: '20E01',
          label: '一楼'
        }, {
          value: '20E02',
          label: '二楼'
        }, {
          value: '20N01',
          label: '三楼'
        }, {
          value: '20N02',
          label: '四楼'
        }],

        //所属校区选择数据
        options4: [{
          value: 'L001',
          label: '在库'
        }, {
          value: 'L002',
          label: '工作'
        }, {
          value: 'L003',
          label: '维护'
        }, {
          value: 'L004',
          label: '保养'
        }, {
          value: 'L005',
          label: '故障'
        }, {
          value: 'L006',
          label: '维修'
        }, {
          value: 'L007',
          label: '报废'
        }],

        customlist:[
          {
            "FBILLNO": "1001",
            "FBILLNAME": "物理化学",
            "FTEACH": "秦始皇",
            "FBILLTYPE": "走班课程",
            "FBILLSTATE": "正常",
            "FMEMO": ""
          },
        ],
        list: [
            {
            "FHOME":"上海博物馆",
            "FFLOOR":"人民广场",
            "FGRAND":"一楼",
            "FADDRES":"1-101展厅",
            "FNUM":"2412080000008",
            "FCARDNO": "E-D-110", 
            "FCATNAME":"大华500",
            "FBRAND":"大华",
            "FBILLSTATE":"工作"
            },{
            "FHOME":"上海博物馆",
            "FFLOOR":"人民广场",
            "FGRAND":"一楼",
            "FADDRES":"1-101展厅",
            "FNUM":"2412080000009",
            "FCARDNO": "E-D-121", 
            "FCATNAME":"大华500",
            "FBRAND":"大华",
            "FBILLSTATE":"工作"
            }
            ,{
            "FHOME":"上海博物馆",
            "FFLOOR":"人民广场",
            "FGRAND":"一楼",
            "FADDRES":"1-101展厅",
            "FNUM":"2412080000010",
            "FCARDNO": "E-D-122", 
            "FCATNAME":"大华500",
            "FBRAND":"大华",
            "FBILLSTATE":"工作"
            },{
            "FHOME":"上海博物馆",
            "FFLOOR":"人民广场",
            "FGRAND":"一楼",
            "FADDRES":"1-101展厅",
            "FNUM":"2412080000011",
            "FCARDNO": "E-D-123", 
            "FCATNAME":"大华500",
            "FBRAND":"大华",
            "FBILLSTATE":"工作"
            },
        ],
        fbillcredate: [jnpf.dateFormat(new Date(), "YYYY-MM-DD"), jnpf.dateFormat(new Date(), "YYYY-MM-DD")],
        loading: false,
        total: 0,
        listQuery: {
          page: 1,
          limit: 20,
          sort: "desc",
          sidx: "",
          fbillstate: "",
          fbillno: "",
          begindate: undefined,
          enddate: undefined,
          fcustomno: "上海博物馆"
        },
      };
    },
    computed: {},
    methods: {
      insert(id) {
        this.$refs.Form.init(id);
      },
    },
  };
</script>